package 练习;

public class 二维数组 {
    public static void main(String[] args){
        //创建动态二维数组
        int a1[][]=new int[3][4];
        for (int i=0;i<a1[0].length;i++){
            System.out.println(a1[0][i]);
        }
        for (int i = 0; i <a1.length ; i++) {//获取三行三列
            for (int j = 0; j <a1[0].length ; j++) {

                System.out.print(a1[i][j]+" ");
            }
            System.out.println("每个执行完会进行换行");
        }


        //创建静态二维数组
        int a[][]={{1,2,3},{4,5},{6,7,8,9},{0}};
        //打印数组中的7
        System.out.println(a[2][1]);
        //打印数组中的0
        System.out.println(a[3][0]);

        for (int i = 0; i <a.length ; i++) {
            for (int j = 0; j <a[i].length ; j++) {
                System.out.print(a[i][j]+" ");
            }
        }


    }
}
